
import { COPYPASTEBTNS, PASTECLEARFIELDS, AREA } from '../../constance';
import { rowCopyPasteUtils } from '../../tool/cardTableTools/rowCopyPasteUtils';

export default function(props, moduleId, record, index) {
        // 效率优化开启
        props.beforeUpdatePage();

        this.state.copyRowDatas = this.copyLineDatas[moduleId]; // 需要粘贴的数据
        if (index >= 0 && record) {
                // 操作列 粘贴至此
                rowCopyPasteUtils.pasteRowsToIndex.call(
                        this,
                        props,
                        moduleId,
                        index,
                        COPYPASTEBTNS[moduleId].initBtns,
                        COPYPASTEBTNS[moduleId].pasteBtns,
                        PASTECLEARFIELDS[moduleId]
                );
        } else {
                // 粘贴至末行
                rowCopyPasteUtils.pasteRowsToTail.call(
                        this,
                        props,
                        moduleId,
                        COPYPASTEBTNS[moduleId].initBtns,
                        COPYPASTEBTNS[moduleId].pasteBtns,
                        PASTECLEARFIELDS[moduleId]
                );
        }
        this.copyLineDatas[moduleId] = null; // 清空复制数据

        // 效率优化关闭
        props.updatePage(AREA.cardFormId, moduleId);
}
